<template>
  <div id="app">
    <nav v-if="flag">
      <router-link to="/">首页</router-link> |
      <router-link to="/about">购物车</router-link>
    </nav>
    <router-view/>
  </div>
</template>
<script>
export default {
  data(){
    return {
      flag:true
    }
  },
  watch:{
    $route:function(n){
      console.log(n);
      if(n.path="/info"){
        this.flag=false;
      }else{
        this.flag=true;
      }
    }
  }
}
</script>

<style lang="scss">
nav a {
  font-weight: bold;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
</style>
